package design_model;

public class Singleton {
    //双重检查单例模式
    private static volatile Singleton st;

    private Singleton(){}

    public static Singleton getInstance(){
        if(st == null){
            synchronized (Singleton.class){
                if(st == null){
                    st = new Singleton();
                }
            }
        }
        return st;
    }
}
